<?php
/**
 * $Id$
 */
!function_exists('adminmsg') && die('Forbidden');

/* 登录即执行一些特定操作 */
define('AUTO_UPDATE', 0);

$query = $db->query("SHOW TABLE STATUS");
while ($rs = $db->fetch_array($query)) {
	if (ereg("^$PW",$rs['Name'])){
		$pw_size = $pw_size + $rs['Data_length'] + $rs['Index_length'];
	} else{
		$o_size = $o_size + $rs['Data_length'] + $rs['Index_length'];
	}
}

$f = $db->get_one("SELECT SUM(size) AS total,COUNT(*) AS count FROM cms_resource");
$filesize 	= round($f['total']/1000, 2); //得到了KB单位
if ($filesize < 1000)
{
	$filesize .= ' KB';
}
elseif ($filesize < 1000000)
{
	$filesize = round($filesize/1000, 2) . ' MB';
}
elseif ($filesize < 1000000000)
{
	$filesize = round($filesize/1000000, 2) . ' GB';
}
else
{
	$filesize = round($filesize/1000000000, 2) . ' TB';
}

$filenum	= $f['count'];

$c			= $db->get_one("SELECT COUNT(*) AS count FROM cms_contentindex");
$contentnum	= $c['count'];
$dayInfo	= getdate();
$today		= mktime(0, 0, 0, $dayInfo['mon'], $dayInfo['mday'], $dayInfo['year']);
$t			= $db->get_one("SELECT COUNT(*) AS count FROM cms_contentindex WHERE postdate >= $today");
$todaynum	= $t['count'];

$filepath 	= R_P;
$o_size		= number_format($o_size/(1024*1024),2);
$pw_size	= number_format($pw_size/(1024*1024),2);
$systemtime	= gmdate("Y-m-d H:i",time()+$very['timedf']*3600);
$altertime	= gmdate("Y-m-d H:i",$timestamp+$very['timedf']*3600);
$sysversion = PHP_VERSION;

if(function_exists("gd_info"))
{
	$gd			= gd_info();
	$gdinfo		= $gd['GD Version'];
}else {
	$gdinfo		= '<span style="color:red">Unknown</span>';
}

if ($very['convert']) {
	$rs = $db->get_one("SELECT COUNT(*) as total FROM cms_resource WHERE ifvideo=1 AND videostate=0");
	$waitnum = $rs['total'];
}
$allowurl	= ini_get('allow_url_fopen') ? '<span style="color:green">环境检测通过</span>' : '<span style="color:red">环境检测不通过，请仔细检查配置信息。</span>';
$freetype	= $gd['FreeType Support'] ? '<span style="color:green">环境检测通过</span>' : '<span style="color:red">环境检测不通过，请仔细检查配置信息。</span>';
$sysos      = $_SERVER['SERVER_SOFTWARE'];
$max_upload = ini_get('file_uploads') ? ini_get('upload_max_filesize') : '<span style="color:red">Disabled</span>';
$max_post = ini_get('post_max_size');
$max_ex_time= ini_get('max_execution_time').' seconds';
$exif = function_exists('exif_read_data') ? '<span style="color:green">环境检测通过</span>' : '<span style="color:red">环境检测不通过，请仔细检查配置信息。</span>';
$mbstring = extension_loaded('mbstring') ? '<span style="color:green">环境检测通过</span>' : '<span style="color:red">环境检测不通过，请仔细检查配置信息。</span>';


@extract($db->get_one("SELECT VERSION() AS dbversion"));
require PrintEot('header');
require PrintEot('main');
adminbottom(0);
?>